package com.stylefeng.guns.rest.modular.vo;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * @author shuc001
 * @Date 2019-01-21 10:51
 */
@Getter
@Setter
public class ResponseVO<T> {
    private int status;
    private String msg;
    private T data;

    private ResponseVO(){}

    public static<T>  ResponseVO success(T data){
        ResponseVO responseVO = new ResponseVO();
        responseVO.status=200;
        responseVO.setMsg("success");
        responseVO.setData(data);
        return responseVO;
    }

    public static<T>  ResponseVO serviceFail(String  msg){
        ResponseVO responseVO = new ResponseVO();
        responseVO.status=1;
        responseVO.setMsg(msg);
        return responseVO;
    }

    public static<T>  ResponseVO appFail(String  msg){
        ResponseVO responseVO = new ResponseVO();
        responseVO.status=500;
        responseVO.setMsg(msg);
        return responseVO;
    }
}
